package top.hudk.math;

import java.math.BigDecimal;
import java.math.RoundingMode;

public class MathTest {


    public static void main(String[] args) {
//        System.out.println(0.2 + 0.1);
//        System.out.println(0.3 - 0.1);
//        System.out.println(0.2 * 0.1);
//        System.out.println(0.3 / 0.1);
//        BigDecimal bigDecimal = new BigDecimal("0");

        System.out.println(2.2+0.1);
        System.out.println(0.9999999f);


        Double d1 = 2.3335D;
        Double d2 = 0.6349D;
        BigDecimal bigDecimal1 = new BigDecimal(Double.toString(d1)).setScale(2, RoundingMode.HALF_DOWN);
        BigDecimal bigDecimal2 = new BigDecimal(Double.toString(d2)).setScale(2, RoundingMode.HALF_DOWN);
        System.out.println(bigDecimal1);
        System.out.println(bigDecimal2);
        System.out.println(bigDecimal1.divide(bigDecimal2,2,RoundingMode.HALF_DOWN));


        System.out.println(new Double(1.0E16D));
    }
}
